package com.zyh.kaoshi;

import java.util.Scanner;

public class Test9 {
    public static void main(String[] args) {
        while (true) {
            System.out.println("请输入用户名：");
            String name = new Scanner(System.in).nextLine();
            boolean flag = true;
            if (name == null || name.length() == 0 || "" == name || name.length() <= 6||name.contains(" ")) {
                flag = false;
            }
            for (int i = 0; i < name.length(); i++) {
                char c = name.charAt(i);
                if (c >= '0' && c <= '9') {
                    flag = false;
                }
            }
            if (flag) {
                System.out.println("用户名输入正常！");
                break;
            } else {
                System.out.println("用户名输入格式错误！");
            }
        }
    }
}
